# coding=utf-8
import enum
from sqlalchemy import Integer, Column, String, Date, Enum
from 学生管理系统.Datebase.Datebase import Base, engine


class GenderEnum(enum.Enum):
    M = 'M'  # 男
    F = 'F'  # 女


class Students(Base):
    __tablename__ = 'students'  # 学生信息表

    id = Column(Integer, primary_key=True, autoincrement=True, comment='学生ID')
    class_name = Column(String(50), nullable=False, comment='学生班级')
    name = Column(String(50), nullable=False, comment='学生姓名')
    hometown = Column(String(100), nullable=True, comment='籍贯')
    grad_school = Column(String(100), nullable=True, comment='毕业院校')
    major = Column(String(100), nullable=True, comment='专业')
    enroll_time = Column(Date, nullable=True, comment='入学时间')
    grad_time = Column(Date, nullable=True, comment='毕业时间')
    education = Column(String(50), nullable=True, comment='学历')
    advisor_id = Column(Integer, nullable=True, comment='导师ID')
    age = Column(Integer, nullable=True, comment='年龄')
    gender = Column(Enum(GenderEnum), nullable=True, comment='性别')


Base.metadata.create_all(bind=engine)  # 移至模型定义后，确保表结构正确创建

#class student1(Base)
#   __tablename__ 'hhh'
#   stu_id = Column(Integer,primary_key=True,autoincrement=True,comment='学生ID')
#   class_name = Column(String(20),nullable=False,comment='班级名称')
#   name = Column(String(20),nullable= False,comment='学生姓名')
